<template>
  <div class="section">
    <div class="section-header">
      <h2>{{ title }}</h2>
      <span class="more">
        {{ moreText }} <i class="fas fa-chevron-right"></i>
      </span>
    </div>
    <div class="items">
      <div v-for="item in items" :key="item.label" class="item">
        <div class="icon-wrapper" :style="{ backgroundColor: item.color }">
          <i :class="item.icon"></i>
        </div>
        <span>{{ item.label }}</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ContentSection',
  props: ['title', 'items'],
  computed: {
    moreText() {
      if (this.title === '我的订单') return '全部订单';
      if (this.title === '我的服务') return '全部服务';
      if (this.title === '个人中心') return '全部中心';
      return '查看更多';
    }
  }
};
</script>

<style scoped>
.section {
  margin: 25px;
  background: #FFF;
  border-radius: 15px;
  padding: 15px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.more {
  font-size: 14px;
  color: #666;
}

.more i {
  font-size: 12px;
}

.items {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.item {
  text-align: center;
  flex: 1;
}

.icon-wrapper {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  transition: transform 0.2s;
}

.icon-wrapper:hover {
  transform: scale(1.1);
}

.icon-wrapper i {
  color: white;
  font-size: 18px;
}

span {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: #666;
}
</style>